﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;

namespace SearchEngine.CMS.Client
{
    public partial class LeftDetail : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String QueryString = "";
            String key = "";
            int sort = 0;
            if (!Page.IsPostBack)
            {
                //thuc hien lay query string 
                if (Request.QueryString["Type"].ToString() != null)
                {
                    QueryString = Request.QueryString["Type"].ToString();
                }
                if (Request.QueryString["Key"].ToString() != null)
                {
                    key = Request.QueryString["Key"].ToString();
                }
                if (Request.QueryString["Sort"].ToString() != null)
                {
                    sort = Convert.ToInt32(Request.QueryString["Sort"].ToString());
                }

                StringBuilder sb = new StringBuilder();
                sb.Append("<ul>");
                if (sort == 0)
                {
                    sb.Append("<li class='mitem'><a id='re' class='curentshow' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=0&Key=" + key +"&Page=1"+ "' onclick='CngMenubar(this)'>Mọi thứ</a></li>");
                }
                else
                {
                    sb.Append("<li class='mitem'><a id='re'  href='DetailSearch.aspx?Type=" + QueryString + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Mọi thứ</a></li>");
                }
                if (sort == 1)
                {
                    sb.Append("<li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=1&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Đường </a></li>");
                }
                else
                {
                    sb.Append("<li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=1&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Đường </a></li>");
                }
                if (sort == 2)
                {
                    sb.Append("<li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=2&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Phường</a></li>");
                }
                else
                {
                    sb.Append("<li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=2&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Phường</a></li>");
                }
                if (sort == 3)
                {
                    sb.Append(" <li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=3&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Quận </a></li>");
                }
                else
                {
                    sb.Append(" <li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=3&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Quận </a></li>"); 
                }
                if (sort == 4)
                {
                    sb.Append(" <li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=4&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Địa Điểm</a></li>");
                }
                else
                {
                    sb.Append(" <li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=4&Key=" + key +"&Page=1"+ "' onclick='CngMenubar(this)'>Địa Điểm</a></li>");
                }
               
               /* if (sort == 6)
                {
                    sb.Append(" <li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + 21 + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Siêu thị</a></li>");
                }
                else
                {
                    sb.Append(" <li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + 21 + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Siêu thị</a></li>");
                }
                if (sort == 7)
                {
                    sb.Append(" <li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + 22 + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Cơ quan</a></li>");
                }
                else
                {
                    sb.Append(" <li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + 22 + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Cơ quan</a></li>");
                }
                if (sort == 8)
                {
                    sb.Append(" <li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + 23 + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Cửa hàng</a></li>");
                }
                else
                {
                    sb.Append(" <li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + 23 + "&Sort=0&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Cửa hàng</a></li>");
                }*/
                if (sort == 5)
                {
                    sb.Append(" <li class='mitem'><a class='curentshow' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=5&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Tỉnh thành phố</a></li>");
                }
                else
                {
                    sb.Append(" <li class='mitem'><a class='kl' href='DetailSearch.aspx?Type=" + QueryString + "&Sort=5&Key=" + key + "&Page=1" + "' onclick='CngMenubar(this)'>Tỉnh thành phố</a></li>");
                }
                sb.Append("</ul>");
                lbhienthi.Text = sb.ToString();
            }
        }
    }
}